﻿using System;
using System.Linq;
using System.Collections.Generic;

namespace HashFoo.Core
{
    /// <summary>
    /// String helpers
    /// </summary>
    public static class StringUtil
    {
        /// <summary>
        /// Executes a string format operation on a string and returns the result.  Does not modify the passed in string.
        /// </summary>
        /// <param name="str"></param>
        /// <param name="args"></param>
        /// <returns></returns>
        public static string DoFormat(this string str, params object[] args)
        {
            return string.Format(str, args);
        }

        /// <summary>
        /// Executes a string format operation.  Probably better to use <see cref="DoFormat"/>.
        /// </summary>
        /// <param name="str"></param>
        /// <param name="args"></param>
        /// <returns></returns>
        [Obsolete("Use DoFormat -- more descriptive and implies an action")]
        public static string FormatEx(this string str, params object[] args)
        {
            return str.DoFormat(args);
        }
    }
}